package com.hwadee.ems.domain.vo;

import java.time.Year;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hwadee.ems.domain.po.TrainingProgram;
import com.hwadee.ems.service.IMajorService;
import com.hwadee.ems.service.impl.MajorServiceImpl;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class TrainingProgramVO {

    @JsonIgnore
    private IMajorService majorService = MajorServiceImpl.getInstance();

    public TrainingProgramVO(TrainingProgram trainingProgram) {
        this.id = trainingProgram.getId();
        this.grade = trainingProgram.getGrade();
        this.majorId = trainingProgram.getMajorId();
        this.majorName = majorService.getById(this.majorId).getName();
        this.courseCount = trainingProgram.getCourseCount();
    }
    
    /**
     * 人才培养方案编号
     */
    private Long id;

    /**
     * 年级
     */
    private Year grade;

    /**
     * 专业编号 references major(id) for (name)
     */
    private Long majorId;

    /**
     * 专业名称
     */
    private String majorName;

    /**
     * 课程数
     */
    private Integer courseCount;

}
